from behave import given, when, then, step


@given('I have entered {number:d} into the calculator')
def step_impl(context, number):
    context.number_a = number
    context.number_b = None
    print(f'You entered {number}')


@given('I have entered {number:d} into the calculator')
def another_step_impl(context, number):
    context.number_b = number
    print(f'You also entered {number}')


@when('I press add')
def step_impl(context):
    context.result = context.number_a + context.number_b
    print(f'You pressed add')


@then('the result should be {result:d} on the screen')
def step_impl(context, result):
    assert context.result == result, f'Result was {context.result} instead of {result}'
    print(f'Result was {context.result}')